import {
	WeaTop,
	WeaRightMenu,
} from 'ecCom';
import {
	observer
} from 'mobx-react';
import PageContent from './PageContent';
import Tab from './Tab';

@observer
export default class Top extends React.Component {
	constructor(props) {
		super(props);
	}

	render() {
		const {
			store
		} = this.props, {
			TOP,
			top,
			pageLoading,
			topButtons,
			dropMenuDatas,
			breadcrumb,
			cPage,
			isSingle,
		} = store;

		let t;
		if (['main', 'recordInfo', 'queryDeductionMoney'].includes(cPage)) {
			t = (
				<Tab ecId={`${this && this.props && this.props.ecId || ''}_Tab@zcwbso`} store={store}/>
			);
		} else {
			t = null;
		}

		const c = (
			<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@kw9hyf`} datas={dropMenuDatas}>
        		{t}
        		<PageContent ecId={`${this && this.props && this.props.ecId || ''}_PageContent@h255xf`} store={store}/>
        	</WeaRightMenu>
		)

		if (isSingle) {
			return c;
		} else {
			return (
				<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@jcxqt7`} 
	               {...TOP}
	               {...top}
	               loading={pageLoading}
	               buttons={topButtons}
	               breadcrumb={breadcrumb}
	               dropMenuDatas={dropMenuDatas}
	            >
	            	{c}
	            </WeaTop>
			);
		}

	}
}